package com.prezs.java_basics;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import java.util.Iterator;
import java.util.List;
import java.util.ListIterator;



public class Lambda {
	public static void main(String[] args) {
		List<String> words =  Arrays.asList("abcd","abd","abc");
//		words.sort((words1,words2) -> words1.length() - words2.length());
//		System.out.println(words);
		words.sort(new Comparator<String>() {
			@Override
			public int compare(String o1, String o2) {
				return o1.length() - o2.length();
			}
			
		});
//		System.out.println(words);
		List<String> newList = new ArrayList<String>();
//		newList.add("1");
//		newList.add("1");
//		newList.add("1");
		ListIterator<String> iterator =  newList.listIterator();
//		System.out.println(iterator);
//		while(iterator.hasNext()) {
//			String ele =  iterator.next();
//			System.out.println(ele);
//		}
		for (String w : words) {
			System.out.println(w);
			iterator.next();
			iterator.set(w);
		}
//		
//		while(iterator.hasNext()) {
//			String ele =  iterator.next();
//			System.out.println(ele);
//		}
	}
}
